Skip to content

Fix #2574 #2657

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed

Conversation

jonsequitur
Copy link
Contributor

This fixes #2574.

Copy link
Member

@adamsitnik adamsitnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've provided my reasoning behind the change. I would be happy to hear the opinions of @baronfel and @jeffhandley. I know Uri is a frequently used type and this could have been a bad decision.

@@ -286,5 +286,17 @@ private static Dictionary<Type, TryConvertString> StringConverters
value = default;
return false;
},

[typeof(Uri)] = (string input, out object? value) =>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed this on purpose in #2127 in order to reduce the number of dependencies and reduce the size of a published NativeAOT app. IIRC it allows us to not include System.Private.Uri.dll for every published app.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should hold off on bringing this back because of the tradeoff. Echoing an offline discussion, I recommend that we lean into IParsable<T> and ISpanParsable<T> and even look ahead to extension interfaces as a better long-term approach for how we can handle more types without taking more hard dependencies like this in the short term.

@KalleOlaviNiemitalo
Copy link

In one program, I'm specifically parsing with UriKind.Relative. (It's a tool for replaying an HTTP request to a web API hosted in-process.)

But I suppose this PR won't make that kind of use any harder, as I can just keep using a custom parser like now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add Uri to ArgumentConverter.StringConverters
4 participants